<!DOCTYPE html>
<title>Verify that a media element's currentSrc is correctly set to source element's src</title>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<video></video>
<script>
async_test(function(t) {
    var video = document.querySelector("video");
    assert_equals(video.currentSrc, "");
    var mediaFile = "content/test.ogv";
    var source = document.createElement("source");
    source.src = mediaFile;
    video.appendChild(source);

    assert_equals(video.currentSrc, "");

    video.oncanplaythrough = t.step_func_done(function () {
        var currentSrc = video.currentSrc;
        assert_equals(currentSrc.substr(currentSrc.lastIndexOf('/media/')+7), mediaFile);
    });
});
</script>